Texture mapping is an important operation in computer graphics. Texture mapping allows a high degree of visual complexity to be applied to rendered scenes but without overly complex modeling. Each point on a textured surface maps to a position in a texture map—each screen coordinate (e.g., x, y) maps to a texture-space coordinate (e.g., s, t). Texture mapping identifies which discrete texture element or elements (e.g., texel) will contribute to each discrete screen element (e.g., pixel).
To further reduce computational complexity, “MIP-mapping” is used with texture mapping. With MIP-mapping, multiple texture maps are pre-produced and stored. Each map corresponds to a particular level of resolution, or level of detail (LOD). Conventionally, successive levels of resolution are scaled by a factor of two. That is, one LOD corresponds to a resolution that is one-half the resolution of the next LOD.
To determine which LOD to use, a texture unit in the graphics pipeline may compute the distance between adjacent pixels in a sample group. For example, a sample group may include four (4) adjacent pixels arranged as a two-by-two array (sometimes referred to as a “quad”). The distances between the pixels in the quad are computed, and an LOD that most closely corresponds to the average distance is selected.
However, there are instances in which all of the pixels in the sample group are not available to determine the LOD. Processing of one or more pixels in the sample group may diverge from the other pixels in the sample group, due to a branch instruction, for example. Thus, an instruction executing on one pixel of the sample group may be different from an instruction executing on another pixel of the sample group. A pixel in a sample group that is in this way out of synch with other pixels in the sample group can be referred to as a “divergent pixel.” Conventionally, a sample group (e.g., quad) that includes a divergent pixel is identified by setting a bit (sometimes referred to as the “divergent bit”).